/**
 * 
 */
package cu.ds.logicalsync.fytasrealm.ui.panel;

import java.awt.FlowLayout;
import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

import java.awt.GridBagConstraints;
import javax.swing.ImageIcon;
import java.awt.Dimension;

/**
 * @author r.vashira
 *
 */
public class PrototypeCommandPanel extends JPanel {

	private static final long serialVersionUID = 1L;
	private JTabbedPane commandTabbedPane = null;
	private JPanel globalCmdTabPanel = null;
	private JPanel battleCmdPanel = null;
	private JPanel stateCmdPanel = null;

	/**
	 * This is the default constructor
	 */
	public PrototypeCommandPanel() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
		gridBagConstraints.fill = GridBagConstraints.BOTH;
		gridBagConstraints.gridy = 0;
		gridBagConstraints.weightx = 1.0;
		gridBagConstraints.weighty = 1.0;
		gridBagConstraints.gridx = 0;
		this.setSize(400, 300);
		this.setLayout(new GridBagLayout());
		this.setPreferredSize(new Dimension(300, 88));
		this.add(getCommandTabbedPane(), gridBagConstraints);
	}

	/**
	 * This method initializes commandTabbedPane	
	 * 	
	 * @return javax.swing.JTabbedPane	
	 */
	private JTabbedPane getCommandTabbedPane() {
		if (commandTabbedPane == null) {
			commandTabbedPane = new JTabbedPane();
			commandTabbedPane.addTab("Global", new ImageIcon(getClass().getResource("/cu/ds/logicalsync/fytasrealm/resources/images/world.png")), getGlobalCmdTabPanel(), "Global Commands");
			commandTabbedPane.addTab("Battle", new ImageIcon(getClass().getResource("/cu/ds/logicalsync/fytasrealm/resources/images/lightning.png")), getBattleCmdPanel(), "Battle Commands");
			commandTabbedPane.addTab("State", new ImageIcon(getClass().getResource("/cu/ds/logicalsync/fytasrealm/resources/images/heart.png")), getStateCmdPanel(), "State Related Commands");
		}
		return commandTabbedPane;
	}

	/**
	 * This method initializes globalCmdTabPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getGlobalCmdTabPanel() {
		if (globalCmdTabPanel == null) {
			globalCmdTabPanel = new JPanel();
			globalCmdTabPanel.setLayout(new FlowLayout());
			globalCmdTabPanel.setToolTipText("Global Commands");
			
			JLabel jLabel = new JLabel();
			JTextField jTextField = new JTextField();
			JButton button = new JButton();
			
			jLabel.setText("Peer Name");
			jTextField.setColumns(10);
			button.setText("Search");

			globalCmdTabPanel.add(jLabel, null);
			globalCmdTabPanel.add(jTextField, null);
			globalCmdTabPanel.add(button, null);
			
			jLabel = new JLabel();
			jTextField = new JTextField();
			button = new JButton();
			
			jLabel.setText("Peer Name");
			jTextField.setColumns(10);
			button.setText("Get ID");
			
			globalCmdTabPanel.add(jLabel, null);
			globalCmdTabPanel.add(jTextField, null);
			globalCmdTabPanel.add(button, null);
		}
		return globalCmdTabPanel;
	}

	/**
	 * This method initializes battleCmdPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getBattleCmdPanel() {
		if (battleCmdPanel == null) {
			battleCmdPanel = new JPanel();
			battleCmdPanel.setLayout(new GridBagLayout());
			battleCmdPanel.setToolTipText("Battle Commands");
		}
		return battleCmdPanel;
	}

	/**
	 * This method initializes stateCmdPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getStateCmdPanel() {
		if (stateCmdPanel == null) {
			stateCmdPanel = new JPanel();
			stateCmdPanel.setLayout(new GridBagLayout());
			stateCmdPanel.setToolTipText("State Related Commands");
		}
		return stateCmdPanel;
	}

}
